<?php

/**
 * Class MY_Model
 * 初始化websocket连接
 */
class MY_Model extends CI_Model {

    protected $wsClient;

    public function __construct()
    {
        parent::__construct();
        $this->load->library('WebSocketClient');

        $this->wsClient = new WebSocketClient('swoole', 9527);
        $this->wsClient->connect();

    }

    public function __destruct()
    {
        $this->wsClient->close();
    }

}